<?php

namespace app\admin\middleware;

/**
 * 检测应用是否开启
 */
class Check
{

    /**
     * 处理请求
     */
    public function handle($request, \Closure $next)
    {
        // 应用名称
        $appName = app('http')->getName();
        // 获取配置
        $lock = base_path() . $appName . '/config/delete.lock';
        if (file_exists($lock)) {
            return json(['msg' => '当前应用维护中']);
        }
        return $next($request);
    }
}
